"""首页浏览代发商品 进行购买"""
import allure
from base.WebKeys import WebKeys
from page.home_purchase_pc_page.home_purchase_pc_dict import get_mall_xpath

class MallFlow_home_purchase(WebKeys):

    def xl_home_select_products(self):
        """首页选择商品 进行加购 代发"""

        with allure.step("鼠标滑动到商品"):
            self.slide_element(get_mall_xpath('xl_element'))

        with allure.step("点击商品 进入商品详情"):
            self.wait_click(get_mall_xpath('xl_element'))

        with allure.step("切换到最新窗口"):
            self.switch_to_tab(-1)

        with allure.step("默认代发商品 加入购物车"):
            self.wait_click(get_mall_xpath('Add_to_cart'))


    # def get_result_true(self):
    #     """断言加入购物车成功提示语"""
    #     Assertion = '//*[@id="ant-message"]/span/div/div'
    #     result=self.read(Assertion)
    #     print(result)
    #     return result

#
# if __name__ == '__main__':
#     MallFlow_home_purchase=MallFlow_home_purchase()
#     MallFlow_home_purchase.xl_home_select_products()